﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using KhatVongViet.Models;
using PagedList;

namespace KhatVongViet.Controllers
{
    public class ManageController : Controller
    {
        GetData getData = new GetData();
        KhatVongVietEntities dataContext = new KhatVongVietEntities();

        public ActionResult ActivitiesPage()
        {
            return View();
        }

        public ActionResult IntroductionPage()
        {
            return View();
        }

        public ActionResult NewsPage()
        {
            return View();
        }

        public ActionResult MemberPage(string id, int page = 1)
        {
            List<Member> listMember = getData.GetListMembers(id);

            int numberitemperpage = 5;
            ViewBag.id = id;
            ViewBag.ListMember = listMember;
            ViewBag.Page = page;
            ViewBag.NumberItemPerPage = 5;
            ViewBag.NumberMember = listMember.Count();
            return View(listMember.OrderBy(v => v.ID).ToPagedList(page, numberitemperpage));
        }

        [HttpGet]
        public ActionResult DetailMember(string memberId)
        {
            int id = Convert.ToInt16(memberId);
            Member member = getData.GetMember(id);
            return View(member);
        }
        
        public ActionResult LibraryPage()
        {
            return View();
        }

        public ActionResult ContactPage()
        {
            return View();
        }
    }
}
